package main
{
	import com.adobe.serialization.json.JSON;
	import com.darwin.darwinMVC.core.Context;
	import com.darwin.darwinMVC.core.ContextPlace;
	import com.darwin.darwinMVC.mvc.DataSource;
	import com.darwin.darwinNet.IDataHandle;
	
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class AppNetAdapter extends EventDispatcher implements IDataHandle
	{
		//数据源
		private var _dataSource:AppDataSource;
		private var _context:Context;
		public function AppNetAdapter()
		{
			super();
			_context = ContextPlace.getContext();
			_dataSource = _context.dataSource as AppDataSource;
		}
		

		public function dataHandle(data:Object):void
		{
			
		}
		
		public function cmdDataHandle(cmd:String,data:Object):void
		{
			trace("AppNetAdapter.cmdDataHandle-cmd:"+cmd+"-data:-----"+com.adobe.serialization.json.JSON.encode(data));
			_dataSource.setData(cmd,data);
		}
	}
}